package com.saint.commons.config;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class ProcessEngineConfig {

    @Bean
    public ProcessEngine processEngine() {
        long start = System.currentTimeMillis();
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        log.info("init ProcessEngine - {}", System.currentTimeMillis() - start);
        return processEngine;
    }

    /*@Bean
    public ProcessEngine processEngineByConfig() {
        long start = System.currentTimeMillis();
        ProcessEngineConfiguration configuration = ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.cfg.xml");
        ProcessEngine processEngine = configuration.buildProcessEngine();
        System.out.println("init ProcessEngineConfiguration - " + (System.currentTimeMillis() - start));
        return processEngine;
    }*/
}
